package es.upm.fi.robots;

import java.util.List;

public class Robot 
{
	
	public int zoneProbabilistic(double[] probs)
	{
		int index=0;
		double rand = Math.random();
		double sum =0;
		for (int i=0;i<probs.length;i++)
		{
			sum= sum +probs[i];
			if (rand<sum) return i;
			//else if (i!=0 && rand>=probs[i-1] && rand <probs[i]) return i;

		}
		
		return index;
	}
	
	public int zoneWithMoreTasks(List<Zone> zones)
	{
		long max=Integer.MIN_VALUE;
		int index = 0,i=0;
		for (Zone z:zones)
		{
			if (z.getTasks()>max) 
				{
				max = z.getTasks();
				index=i;
				}
			i++;
		}
		return index;
	}

}
